package it.tcm.TeacherClassMate.action;


import it.tcm.TeacherClassMate.facade.EquationManageBase;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;



public class AboutAction extends Action {

	// --------------------------------------------------------- Instance Variables

	// --------------------------------------------------------- Methods


	private Logger logger = Logger.getLogger(this.getClass().getName());
	
	/** 
	 * Method execute
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 * 
	 */

	public ActionForward execute(
		ActionMapping mapping,
		ActionForm form,
		HttpServletRequest request,
		HttpServletResponse response) 
	{		
		 logger.info("ABOUT");
		 EquationManageBase eqm = new EquationManageBase();
		 Integer i = eqm.getTotalNumberOfEquation();
		 String s = "0000";
		 if (i>10 && i<100)
			 s= "00" + i;
	     else if (i<10)
	    	 s= "000" + i;
	     else if (i>100 && i<1000)
	    	 s= "0" + i;
	     else s = i.toString();
		 request.setAttribute("numberOfEquation", s);
		 return mapping.findForward("showAbout"); 
		 
	}
	
	
}